Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance the warning when use undeclared variable in template #5010

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

caozhong1996
Copy link
Contributor

fix: #4305

No idea how to add test, because it will broken other test. So I add !__TEST__ to avoid test fail.😢

You can clone this project: https://github.com/caozhong1996/v3-warn-demo.

I added those code in vue.js:

// line 7468
} else if (
  !(key[0] === '$' || key[0] === '_')
) {
  warn$1(
    `Property ${JSON.stringify(key)} was accessed during render ` +
      `but is not defined on instance.`
  )
}

impicture_20211128_204342

@haoqunjiang haoqunjiang added the 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. label Apr 1, 2024
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 38 kB 34.2 kB
vue.global.prod.js 159 kB 57.9 kB 51.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.9 kB 18.3 kB 16.7 kB
createApp 55 kB 21.3 kB 19.4 kB
createSSRApp 59 kB 23 kB 20.9 kB
defineCustomElement 59.8 kB 22.8 kB 20.8 kB
overall 68.7 kB 26.3 kB 24 kB

Copy link

pkg-pr-new bot commented Oct 24, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@5010

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@5010

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@5010

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@5010

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@5010

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@5010

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@5010

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@5010

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@5010

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@5010

vue

pnpm add https://pkg.pr.new/vue@5010

commit: d516036

@edison1105
Copy link
Member

No idea how to add test, because it will broken other test

Could you please try to add an e2e test case?

@edison1105 edison1105 added need test The PR has missing test cases. wait changes labels Oct 24, 2024
@caozhong1996 caozhong1996 changed the title enhance the warning when not explicitly declare the variable enhance the warning when use undeclared variable in template Oct 25, 2024
@caozhong1996
Copy link
Contributor Author

No idea how to add test, because it will broken other test

Could you please try to add an e2e test case?

Done, I almost forgot about this pr, I'm glad to see that you're still persisting in maintaining vue-next. It has been a really long time, salute🫡 @edison1105

@edison1105 edison1105 added ready to merge The PR is ready to be merged. and removed need test The PR has missing test cases. wait changes labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready to merge The PR is ready to be merged.
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

enhance the warning when not explicitly declare the handler
3 participants